
<div class="widget">
	<div class="widget-header bg-blue">
		<i class="widget-icon icon-notebook"></i> <span class="widget-caption">
			广告发布 </span>
		<div class="widget-buttons">
			<a href="javascript:void(0);" onclick="handlerCancel(this);"
				title="关闭" data-toggle="dispose" data-refresh-table="#table-banner">
				<i class="fa fa-times"></i>
			</a>
		</div>
	</div>
	<div class="widget-body">
		
		
		<!-- TODO 广告图片 -->
		<div class="widget radius-bordered">
			<div class="widget-header ">
				<i class="widget-icon ion-images"></i> 
					<span class="widget-caption"> <a href="" data-toggle="collapse">广告图片 </a>
					</span>
				<div class="widget-buttons compact">
					<a href="" data-toggle="collapse"> <i class="fa fa-compress"></i></a>
				</div>
			</div>
			<div class="widget-body">
				<div class="row">
					<div class="col-sm-12">
						<input id="upload" name="file" type="file" class="file-loading"
						accept="image/*" multiple>
					</div>
				</div>
			</div>
		</div>
		
		
		<!-- TODO 基本信息 -->
		<div class="widget radius-bordered">
			<div class="widget-header">
				<i class="widget-icon icon-notebook"></i> <span
					class="widget-caption"> 基本信息 </span>
			</div>
			<div class="widget-body editor-body-sm">
				<form class="form-horizontal form-editor form-editor-banner">
				
					<div class="row">
						<div class="col-sm-8">
							<div class="form-group">
								<label class="col-sm-2 control-label required" for="link" >广告链接</label>
								<div class="col-sm-10">
									<input name="link" id="link" type="text"
										class="form-control" required="required">
								</div>
							</div>
						</div>
						<div class="col-sm-4">
							<div class="form-group">
								<label class="col-sm-4 control-label required" for="status">广告位置</label>
								<div class="col-sm-8">
									<select name="status" id="status" class="chosen-select "> 
										<option value="0">欢迎页</option>
										<option value="1">顶部banner</option>
										<option value="2">底部banner</option>
									</select>
								</div>
							</div>
						</div>
					</div>
					
					<div class="row">
						<div class="col-sm-8">
							<div class="form-group">
								<label class="col-sm-2 control-label" for="url">广告图片</label>
								<div class="col-sm-10">
									<input name="url" id="url" type="text"
										class="form-control" readonly="readonly">
								</div>
							</div>
						</div>
						<div class="col-sm-4">
							<div class="form-group">
								<label class="col-sm-4 control-label" for="username">发布人</label>
								<div class="col-sm-8">
									<input name="username" id="username" type="text" class="form-control" readonly="readonly">
									<input name="userid" id="userid" type="hidden">
								</div>
							</div>
						</div>
					</div>
					
					<div class="row">	
						<div class="col-sm-4">
							<div class="form-group">
								<label class="col-sm-4 control-label" for="organ">投放机构</label>
								<div class="col-sm-8">
									<input name="organ" id="organ" type="text"
										class="form-control" >
								</div>
							</div>
						</div>
						<div class="col-sm-4">
							<div class="form-group">
								<label class="col-sm-4 control-label" for="price">投放金额</label>
								<div class="col-sm-8">
									<input name="price" id="price" type="text"
										class="form-control" >
								</div>
							</div>
						</div>
						<div class="col-sm-4">
							<div class="form-group">
								<label class="col-sm-4 control-label" for="createDate">签约时间</label>
									<div class="col-sm-8">
											<div class="input-group date date-selector">
													<input name="createDate" id="createDate" type="text" class="form-control" value="" > 
													<span class="input-group-addon">
														<span class="fa fa-calendar"></span>
													</span>
												</div>
									</div>
							</div>
						</div>
					</div>
					
					<div class="row">
						<div class="col-sm-4">
							<div class="form-group">
								<label class="col-sm-4 control-label" for="fromDate">起止时间</label>
								<div class="col-sm-8">
									<div class="input-group date date-selector">
										<input name="fromDate" id="fromDate" type="text" class="form-control" value=""> 
										<span class="input-group-addon">
											<span class="fa fa-calendar"></span>
										</span>
									</div>
								</div>
							</div>
						</div>
					 	<div class="col-sm-4">
							<div class="form-group">
								<label class="col-sm-4 control-label" for="overDate">终止时间</label>
								<div class="col-sm-8">
									<div class="input-group date date-selector">
										<input name="overDate" id="overDate" type="text" class="form-control" value=""> 
										<span class="input-group-addon">
											<span class="fa fa-calendar"></span>
										</span>
									</div>
								</div>
							</div>
						</div>
					</div>
					
					<div class="widget-footer editor-footer-sm">
						<button type="button" class="btn btn-danger btn-sm"
							data-toggle="tooltip" data-placement="top" title="取消"
							onclick="handlerCancel(this);" data-refresh-table="#table-banner">
							<i class="glyphicon glyphicon-remove"></i>
						</button>
						<button type="button" class="btn btn-primary btn-sm"
							data-toggle="tooltip" data-placement="top" title="保存"
							onclick="handlerSubmit(this, '#editor-form-banner', '.form-editor-banner');">
							<i class="glyphicon glyphicon-ok"></i>
						</button>
					</div>
				</form>
			</div>
		</div>


	</div>
</div>

<!-- 提交表单 ========================================================= -->
<form id="editor-form-banner" action="/miwawa/default/common/save" method="post" 
		name="com.app.miwawa.api.system.entity.Banner"
		data-show-target="#editor-panel-codesub">
		<input type="hidden" name="bean['invalid']" value="F">
</form>

<script type="text/javascript">
<!--
	jQuery(function() {
		
		console.log(username);
		
		
		require(['jquery.plugin.form' ], function( form) {
			jQuery("#userid",".form-editor-banner").val(userid);
			jQuery("#username",".form-editor-banner").val(username);
			
			form.tooltip("[data-toggle='tooltip']");

			form.datepicker('.date-selector');
			form.chosen("#status").select("#status",null,function(chosen){
				
			});

			// 注册文件上传控件
			form.fileinput("#upload", {
				uploadUrl : "/miwawa/default/file/upload",
				uploadExtraData : {
					"group" : "banner",
					"mode" : "file",
					"type" : "image"
				},
				allowedFileExtensions : [ "jpg", "png", "gif" ],
				onUploadSuccess : function(event, data, previewId, index) {
					event.preventDefault;
					jQuery("#url").val(data.response.url);
					jQuery("#upload").fileinput('reset');

				}
			});

		});
	});
	
//-->
</script>